﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectQuaDep
{
    public partial class Home : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string useragent = Request.UserAgent.ToString();
            if (IsMobile(useragent) == true || Request.Browser.IsMobileDevice == true)
            {
                Response.Redirect("https://m.hongthuy.com.vn");
            }
        }
        public bool IsMobile(string userAgent)
        {
            userAgent = userAgent.ToLower();
            return userAgent.Contains("iphone") |
            userAgent.Contains("ppc") |
            userAgent.Contains("windows ce") |
            userAgent.Contains("blackberry") |
            userAgent.Contains("opera mini") |
            userAgent.Contains("mobile") |
            userAgent.Contains("palm") |
            userAgent.Contains("portable") |
            userAgent.Contains("android");
        }
    }
}